<include file="Public:header" />


<!-- main content start-->
<div class="main-content" >

<!-- header section start-->
<div class="header-section">
    <!--toggle button start-->
    <a class="toggle-btn"><i class="fa fa-bars"></i></a>
    <!--toggle button end-->
    <!--search start-->
    <form class="searchform" method="post">
        <input type="text" class="form-control" name="search" placeholder="搜索" value="{$search}"/>
        <span class="input-group-btn" style="float:left;line-height: 50px;">
            <button type="submit" class="btn btn-default"><i class="fa fa-search"></i></button>
        </span>
    </form>
    <!--search end-->
    <!--notification menu start -->
    <div class="menu-right">
        <ul class="notification-menu" style="margin-top: 15px;">
            <li>
                <span class="span" style="margin-top: 100px;"><!-- data-toggle="dropdown"-->
                    账户余额(元)<span style="color: red; font-size: 16px; font-weight: 800 ">{$info.money}</span>
                </span>
            </li>

        </ul>
    </div>
    <!--notification menu end -->
</div>
<!-- header section end-->
<!-- page heading start-->
<div class="page-heading">
    <h3>
        活动管理
    </h3>
    <ul class="breadcrumb">
        <li>
            <a href="#">首页</a>
        </li>
        <li> 活动管理 </li>
        <li class="active"> 活动列表 </li>
    </ul>
</div>
<!-- page heading end-->

<!--body wrapper start-->
<div class="wrapper">
    <section class="panel">
        <a class="btn btn-success" href="/Shopadmin/Code/add_code.html" id="editable-sample_new" style="margin: 15px;"><i class="fa fa-plus"></i> 添加活动</a>

        <div class="panel-body">
            <section id="unseen">
                <table class="table table-bordered table-striped table-condensed" >
                    <thead>
                    <tr >
                        <th>ID</th>
                        <th>是否可用</th>
                        <th>标题</th>
                        <th>活动浏览量</th>
                        <th>图片</th>
                        <th>活动限额</th>
                        <th>最小红包金额</th>
                        <th>最大红包金额</th>
                        <th>活动二维码</th>
                        <th>生成时间</th>
                        <th>操作</th>
                    </tr>
                    </thead>
                    <tbody>
                    <empty name="list" >{$msg}</empty>
                    <volist name="list" id="vo" >
                        <tr align="center"  >
                            <td align="center" valign="center" style="line-height: 100px;">{$vo.id}</td>
                            <td style="line-height: 100px;">{$vo.status}</td>
                            <td style="line-height: 100px;">{$vo.title}</td>
                            <td style="line-height: 100px;">{$vo.view}</td>
                            <td style="line-height: 100px;"><empty name="vo.image">
                                -
                                <else/>
                            <img src="{$vo.image}" width="100" height="100">
                            </empty>
                            </td>

                            <td style="line-height: 100px;">{$vo.quota_money}</td>
                            <td style="line-height: 100px;">{$vo.money}</td>
                            <td style="line-height: 100px;">{$vo.max_money}</td>
                            <td style="line-height: 100px;">
                                <empty name="vo.codeimg">
                                    -
                                    <else/>
                                    <img src="{$vo.codeimg}" id="code{$vo.id}" onclick="big({$vo.id})"   width=" 80" height="80">
                                    <img src="{$vo.codeimg}" id="codes{$vo.id}" style="display: none"  width="200" height="200">
                                </empty>
                            </td>
                            <td style="line-height: 100px;">
                                <empty name="vo.addtime">
                                    -
                                    <else/>
                                    {$vo.addtime}
                                </empty>
                            </td>
                            <td style="line-height: 100px;">
                                <a class="btn btn-xs btn-info" href="{:U('Shopadmin/Code/update',array('id'=>$vo['id']))}"><i class="fa fa-edit"></i>修改</a>
                                <a class="btn btn-xs btn-warning userDelete" onclick="del({$vo.id})"><i class="fa fa-trash-o"></i>删除</a>
                                <a class="btn btn-xs btn-warning userDelete" onclick="detail({$vo.id})"><i class="fa fa-trash-o"></i>活动领取详情</a>
                            </td>
                        </tr>
                    </volist>
                    </tbody>
                </table>


                <div class="row">
                    <div class="col-lg-12">
                        <div class="dataTables_paginate paging_bootstrap pagination">
                            {$pages}
                        </div>
                    </div>
                </div>
            </section>
        </div>
    </section>
</div>
<!--body wrapper end-->
<!-- main content end-->
    <script >
   function big(id) {
       $("#code"+id).click(function () {
           $(this).hide();
           $("#codes"+id).show();
       });
       $("#codes"+id).click(function () {
           $(this).hide();
           $("#code"+id).show();
       });
   }
        function del(id){
            if(confirm("确认删除")){
                var url="{:U('Shopadmin/code/delete')}";
                $.post(url,{id:id},function(res){
                    if(res.code==200){
                        toast(res.msg,true);
                        location.reload()
                    }else{
                        toast(res.msg,false);
                    }
                });
                return false;
            }else{
                return false;
            }
        }
        function detail(id) {
            var url="/Shopadmin/code/detail/id/"+id;
            window.location.href=url;
        }
    </script>
<include file="Public:footer" />